{% if not environment.web %}
{% extends 'index.html' %}
{% endif %}

{% block body %}
    {% if dao %}
<div class="row">
     <div class="col-xs-12 col-md-12">
        <div class="panel panel-default">
              <div class="panel-heading"><h4>N° {{dao.numero}} del  {{utils.dateToString(dao.data_inizio)}}</h4></div>
  <div class="panel-body">

    {% if dao.righeprimanota|length >1 %}
      <div class="col-sm-6"><span class="label label-default">Descrizione</span><p style="display:inline;"> {{dao.note|nonone}}</p></div><br/>
    {% endif %}
      <div class="clearfix"></div>
                <div class="panel panel-primary">
            <div class="panel-heading">
              <h5 class="panel-title">Operazioni&nbsp;&nbsp; ({{dao.righeprimanota|length}})</h5>
            </div>
            <div class="panel-body">
<div class="table-responsive">
  <table class="table  table-bordered table-striped table-condensed">
   <tr>
        <th><b>DESCRIZIONE</b></th>
        <th><b>VALORE</b></th>
        <th><b>TIPO</b></th>
        <th><b>RIF.</b></th>
        <th><b>NOTE</b></th>
    </tr>
        {% for riga in dao.righeprimanota %}
        <tr>
            <td>{{riga.denominazione|replace("\\n"," ")}}</td>
            {% if riga.segno =="entrata" %}
                <td style="color:green;">{{utils.mNLC(riga.valore,2)}}</td>
            {% elif riga.segno =="uscita" %}
            <td style="color:red;">-{{utils.mNLC(riga.valore,2)}}</td>
            {% endif %}
            {% if riga.tipo == "banca" %}
            <td style="color:blue;">{{(riga.tipo)}}</td>
            {% elif riga.tipo == "cassa" %}
        	<td style="color:orange;">{{riga.tipo}}</td>
            {% else %}
        	<td style="color:brown;">{{riga.tipo}}</td>
            {% endif %}
			<td>{{riga.banca[0:30]}}</td>
			<td>{{ riga.note_primanota|nonone }}</td>
        </tr>
        {% endfor %}
  </table>
</div>
        {% if dao.righeprimanota|length==1 %}
           <div class="col-sm-12"><span class="label label-default">Note</span><h4 style="display:inline;"> {{dao.note|nonone}}</h4></div>
        {% endif %}
            </div>
  </div> <!-- chiude il panel principale -->
       <div class="col-sm-4">
      <div class="panel panel-info">
      	  <div class="panel-heading">
      			<h3 class="panel-title">BANCA</h3>
      	  </div>
      	  <div class="panel-body">
      			        <div class="col-sm-12"><span class="label label-success">ENTRATE</span><h4 style="display:inline;"><strong> {{utils.mNLC(dao.totali["tot_entrate_banca"],2)}}</strong></h4></div>
                      <div class="col-sm-12"><span class="label label-danger">USCITE</span><h4 style="display:inline;"><strong> {{utils.mNLC(dao.totali["tot_uscite_banca"],2)}}</strong></h4></div>
      	  </div>
      </div>
           </div>
       <div class="col-sm-4">
       <div class="panel panel-warning">
      	  <div class="panel-heading">
      			<h3 class="panel-title">CASSA</h3>
      	  </div>
      	  <div class="panel-body">
      			        <div class="col-sm-12"><span class="label label-success">ENTRATE</span><h4 style="display:inline;"><strong> {{utils.mNLC(dao.totali["tot_entrate_cassa"],2)}}</strong></h4></div>
                      <div class="col-sm-12"><span class="label label-danger">USCITE</span><h4 style="display:inline;"><strong> {{utils.mNLC(dao.totali["tot_uscite_cassa"],2)}}</strong></h4></div>
      	  </div>
      </div></div>
       <div class="col-sm-4">
             <div class="panel panel-danger">
      	  <div class="panel-heading">
      			<h2 class="panel-title">TOTALI E SALDI</h2>
      	  </div>
      	  <div class="panel-body">
      			        <div class="col-sm-12"><span class="label label-success">ENTRATE</span><h4 style="display:inline;"><strong> {{utils.mNLC(dao.totali["tot_entrate"],2)}}</strong></h4></div>
                      <div class="col-sm-12"><span class="label label-danger">USCITE</span><h4 style="display:inline;"><strong> {{utils.mNLC(dao.totali["tot_uscite"],2)}}</strong></h4></div>
              <div class="col-sm-12"><span class="label label-warning">SALDO</span><h4 style="display:inline;"><strong> {{utils.mNLC(dao.totali["totale"],2)}}</strong></h4></div>


      	  </div>
      </div></div>
        </div>
    </div>
</div> <!-- chiude il row principale -->
        {% else %}
        <p><img src= "gui/attenzione_48X48.png">ELIMINATO: Niente da visualizzare</p>
        <p><img src= "gui/testata_promogest2.png"></p>
        {% endif %}



{% endblock %}
